Skip to content

Fix flaky ReplaceTrivialConvWithLinear pass validation tolerance (#18482)#18482

Merged
meta-codesync[bot] merged 1 commit intopytorch:mainfrom
hsharma35:export-D98001101
Mar 25, 2026
Merged

Fix flaky ReplaceTrivialConvWithLinear pass validation tolerance (#18482)#18482
meta-codesync[bot] merged 1 commit intopytorch:mainfrom
hsharma35:export-D98001101

Conversation

@hsharma35
Copy link
Copy Markdown
Contributor

@hsharma35 hsharma35 commented Mar 24, 2026

Summary:

The test_replace_conv2d_with_linear and test_replace_conv1d_with_linear
tests validate that replacing trivial convolutions with linear ops produces
numerically equivalent outputs. Both operations compute the same dot product
(sum of element-wise products), but conv accumulates across spatial dimensions
(C,H,W) while linear accumulates over a flattened K dimension. With K=294
(conv2d: 677) or K=672 (conv1d: 96*7) fp32 terms, different accumulation
orders produce diffs up to ~1.2e-05 due to non-associativity of floating-point
addition.

This is not a correctness issue — the mathematical operation is identical.
Relax rtol from 1e-05 to 2e-05 to accommodate fp32 accumulation order
differences while remaining tight enough to catch real bugs.

Reviewed By: DrJessop

Differential Revision: D98001101

@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Mar 24, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18482

Note: Links to docs will display an error until the docs builds have been completed.

❌ 29 Cancelled Jobs, 2 Unrelated Failures

As of commit 5c7745a with merge base 123860f (image):

CANCELLED JOBS - The following jobs were cancelled. Please retry:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 24, 2026
@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync Bot commented Mar 24, 2026

@hsharma35 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D98001101.

@github-actions
Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

…orch#18482)

Summary:

The `test_replace_conv2d_with_linear` and `test_replace_conv1d_with_linear`
tests validate that replacing trivial convolutions with linear ops produces
numerically equivalent outputs. Both operations compute the same dot product
(sum of element-wise products), but conv accumulates across spatial dimensions
(C,H,W) while linear accumulates over a flattened K dimension. With K=294
(conv2d: 6*7*7) or K=672 (conv1d: 96*7) fp32 terms, different accumulation
orders produce diffs up to ~1.2e-05 due to non-associativity of floating-point
addition.

This is not a correctness issue — the mathematical operation is identical.
Relax rtol from 1e-05 to 2e-05 to accommodate fp32 accumulation order
differences while remaining tight enough to catch real bugs.

Reviewed By: DrJessop

Differential Revision: D98001101
@meta-codesync meta-codesync Bot changed the title Fix flaky ReplaceTrivialConvWithLinear pass validation tolerance Fix flaky ReplaceTrivialConvWithLinear pass validation tolerance (#18482) Mar 25, 2026
@meta-codesync meta-codesync Bot merged commit 8f1b5ee into pytorch:main Mar 25, 2026
159 of 162 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants